const BASE_URL = "http://123.207.32.32:9001";
const LOGIN_URL = "http://123.207.32.32:3000";

class Request {
    constructor(url) {
        this.url = url;
    }
    request(url, methods, params, header) {
        return new Promise((resolve, reject) => {
            wx.request({
                url: this.url + '' + url,
                method: methods,
                data: params,
                header,
                success(res) {
                    resolve(res.data)
                },
                fail: reject
            })
        })
    }
    get(url, params){
        return this.request(url, 'get', params);
    }
    post(url, params, header) {
        return this.request(url, 'post', params, header);  
    }
}
export const loginRequest = new Request(LOGIN_URL);
export const musicRequest = new Request(BASE_URL);
